home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / pas_all.zip / TI444.ASC < prev    next >
Text File  |  1992-04-16  |  2KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Turbo Pascal                           NUMBER  :  444
  9.   VERSION  :  All
  10.        OS  :  DOS
  11.      DATE  :  April 16, 1992                           PAGE  :  1/2
  12.  
  13.     TITLE  :  Handling Special Keys and Direct Memory Access
  14.  
  15.  
  16.  
  17.  
  18.   {
  19.   Toggle Controls: -- allow you to check to see if a certain key
  20.   was pressed or to turn off or on a certain key, such as
  21.   activating the Num-Lock key.
  22.  
  23.   MemW[0000:$0417]
  24.   number   bit
  25.       1     0  - Right Shift
  26.       2     1  - Left Shift
  27.       4     2  - Ctrl
  28.       8     3  - Alt
  29.      16     4  - Scroll Lock
  30.      32     5  - Num Lock
  31.      64     6  - Caps Lock
  32.     128     7  - Insert
  33.     256     8  -
  34.     512     9  -
  35.    1024    10  - Sys Req
  36.    2048    11  -
  37.    4096    12  - Scroll Lock Pressed
  38.    8192    13  - Num Lock Pressed
  39.   16384    14  - Caps Lock Pressed
  40.   32768    15  - Insert Pressed
  41.  
  42.   Other memory locations that can be accessed to get/put
  43.   information.
  44.  
  45.   Clock ticks: MemW[$0040:$006C] updates every 58ms.
  46.   Clear Key Buffer: MemW[0000:$041A] := MemW[0000:$041C].
  47.  
  48.   Color Address: $B800:0000; Mono Address: $B000:0000.
  49.  
  50.   Print Screen: inline ($CD/$05).
  51.   }
  52.  
  53.   { example }
  54.   program TrapAlt;
  55.    Uses
  56.      Dos, Crt;
  57.    Var
  58.      i:char;
  59.    Function alt:boolean;
  60.    Begin
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Turbo Pascal                           NUMBER  :  444
  75.   VERSION  :  All
  76.        OS  :  DOS
  77.      DATE  :  April 16, 1992                           PAGE  :  2/2
  78.  
  79.     TITLE  :  Handling Special Keys and Direct Memory Access
  80.  
  81.  
  82.  
  83.  
  84.      if MemW[0000:$0417] and 8<>0 then
  85.        begin
  86.         alt:=true;
  87.         repeat
  88.          if keypressed then
  89.            begin
  90.              alt:=false;
  91.              exit;
  92.            end;
  93.         until MemW[0000:$0417] and 8=0;
  94.        end
  95.        else
  96.         alt:=false;
  97.     End;
  98.  
  99.   Begin
  100.    clrscr;
  101.     repeat
  102.      if keypressed then
  103.        begin
  104.          writeln('non alt');
  105.          i:=readkey;
  106.        end;
  107.      if alt then writeln('Alt key pressed');
  108.     until (i=#13);
  109.   End.
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.